package com.woniuxy.userassembly.apiimpl;


import com.woniuxy.api.RbacPermissionRoleApi;

import com.woniuxy.common.Result;
import com.woniuxy.form.RbacPermissionRoleForm;
import com.woniuxy.userassembly.model.RbacPermissionRole;
import com.woniuxy.userassembly.service.IRbacPermissionRoleService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Liyfi
 * @since 2021-05-22
 */
@RestController
public class RbacPermissionRoleApiController implements RbacPermissionRoleApi {
    @Autowired
    private IRbacPermissionRoleService permissionRoleService;

    @Override
    public Result roleAuthorization(RbacPermissionRoleForm form) {
        RbacPermissionRole permissionRole = new RbacPermissionRole();
        BeanUtils.copyProperties(form,permissionRole);
        int i = permissionRoleService.addPermissionRole(permissionRole);
        if(i == 1){
            return Result.success("角色授权成功");
        }
        return Result.fail("角色授权失败");
    }
}

